package main

import (
	"shell/common/packages"
	"shell/utils"
)

const (
	helpStr = `main command usage: 
  shell: run shell command at tuuid host, example: -a shell -u '1231' -s 'lsblk'
  socks5: start socks5 proxy, example: -a socks5
  redir: start port redir
    1. local port redir, example: -a redir
    2. public net redir, example: -a redir --src-port 9980 --dest-addr 192.168.10.20:9980 -t start
  lsport: list public net redir, example: -a lsport
  lscend: list controlled end, example: -a lscend`

	Role = packages.RoleClient // 默认角色
)

var (
	allowCmd    = [5]string{"shell", "socks5", "redir", "lsport", "lscend"} // 允许的主命令
	allowTarget = [3]string{"start", "soft", "hard"}                        // 允许的端口转发命令
	bytePool    = utils.NewBytesPool()
)

func PortAction(str string) packages.PortRedirStatus {
	switch str {
	case "start":
		return packages.PortOpen
	case "soft":
		return packages.PortSoftStop
	case "hard":
		return packages.PortHardStop
	default:
		return packages.PortHardStop
	}
}
